package com.miki.sirius.demo.logic.controller;


import com.miki.sirius.demo.model.ApiResult;
import com.miki.sirius.demo.model.TestVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * @author Surging
 * @version 1.0
 * @ClassName TestController
 * @date 2022/1/17 16:47
 * @desc
 */
@Api()
@RequestMapping("/api/modules")
@RestController
public class TestController {


    @ApiOperation("get 查询接口")
    @ApiImplicitParams(value = {@ApiImplicitParam(name = "username", dataTypeClass = String.class, value = "用户名")})
    @GetMapping("v1.0.0")
    public ApiResult<TestVo> testGet(@RequestParam(name = "username", required = false) String username) {
        return ApiResult.ok(new TestVo("123", "123"));
    }

    @ApiOperation("post添加接口")
    @ApiImplicitParams(value = {@ApiImplicitParam(dataTypeClass = TestVo.class, value = "添加接口")})
    @PostMapping("v1.0.0")
    public ApiResult<Object>testPost(@RequestHeader(value = "token", required = false) String token,
             @RequestBody TestVo vo) {
        return ApiResult.ok();
    }

}